***Code for 2020 CCES Voter Fraud News Experiment (Section D)
***Supplemental Material for "Your Typical Criminal: Why White Americans Hate Voter Fraud"
***Authors: Adriano Udani, David C. Kimball, and Anita Manion
***Date: 1/29/24
***Data file: ces20umsl.dta

***Recode variables

***Mexican vs. Irish immigrant treatment for news experiment
recode UMS440_split (1=0) (2=1), gen(meximm)
lab var meximm "Mexican immigrant treatment"
label define newstreat 0 "Irish immigrant" 1 "Mexican immigrant"
label values meximm newstreat

***Voter Fraud Punishment
recode UMS440a_1 (1=1) (2=0), gen(vfprison)
replace vfprison = 1 if UMS440b_1==1
replace vfprison = 0 if UMS440b_1==2
lab var vfprison "Prison for voter fraud"

recode UMS440a_2 (1=1) (2=0), gen(vfcserv)
replace vfcserv = 1 if UMS440b_2==1
replace vfcserv = 0 if UMS440b_2==2
lab var vfcserv "Community service for voter fraud"

recode UMS440a_3 (1=1) (2=0), gen(vfprob)
replace vfprob = 1 if UMS440b_3==1
replace vfprob = 0 if UMS440b_3==2
lab var vfprob "Probation for voter fraud"

recode UMS440a_4 (1=1) (2=0), gen(vffine)
replace vffine = 1 if UMS440b_4==1
replace vffine = 0 if UMS440b_4==2
lab var vffine "Fine for voter fraud"

recode UMS440a_5 (1=1) (2=0), gen(vfwarn)
replace vfwarn = 1 if UMS440b_5==1
replace vfwarn = 0 if UMS440b_5==2
lab var vfwarn "Warning for voter fraud"

***Latino racism
recode UMS311 (1 = 5 "Strongly agree") (2 = 4 "Somewhat agree") (3 = 3 "Neither agree nor disagree") (4 = 2 "Somewhat disagree") (5 = 1 "Strongly disagree"), gen(UMS311_1rev)
recode UMS313 (1 = 5 "Strongly agree") (2 = 4 "Somewhat agree") (3 = 3 "Neither agree nor disagree") (4 = 2 "Somewhat disagree") (5 = 1 "Strongly disagree"), gen(UMS313_1rev)
alpha UMS311_1rev UMS312 UMS313_1rev UMS314, item gen(latracism)
lab var latracism "Latino racism"
gen latracism1 = (latracism - 1)/4
lab var latracism1 "Latino racism"

***Racial resentment
recode CC20_441a (1 = 5 "Strongly agree") (2 = 4 "Somewhat agree") (3 = 3 "Neither agree nor disagree") (4 = 2 "Somewhat disagree") (5 = 1 "Strongly disagree"), gen(CC441a_1rev)
alpha CC441a_1rev CC20_441b, item gen(rresent)
gen rresent1 = (rresent - 1)/4
lab var rresent1 "Racial resentment"

***Political Interest
recode newsint (1=1) (2=.67) (3=.33) (4=0) (7=.5), gen(ni1)
lab var ni1 "Political interest"

***Voter fraud typification
gen vflatin = UMS357_1/100
gen vfblack = UMS356_1/100
gen vfwhite = UMS355_1/100
lab var vflatin "Voter fraud typification - latinx"
lab var vfblack "Voter fraud typification - black"
lab var vfwhite "Voter fraud typification - white"

***Party ID
***Higher values indicate Republicans
recode pid7 (8=4), gen(pi7)
lab var pi7 "Party ID - 7pt"
gen pi1 = (pi7 - 1)/6
lab var pi1 "Party ID - 7pt"

***Race
recode race (1=1) (2/8=0), gen(white)

***Female
recode gender (1=0) (2=1), gen(female)

***Age
gen age1 = ((2020 - birthyr) - 18)/73
***Education
gen ed1 = (educ - 1)/5

***Political Knowledge
recode CC20_310a (1=0) (2=1) (3/4=0), gen(khouse)
recode CC20_310b (1=1) (2/4=0), gen(ksen)
gen kmh = 0
replace kmh = 1 if CC20_311d == 3 & CurrentHouseParty=="Democratic"
replace kmh = 1 if CC20_311d == 2 & CurrentHouseParty=="Republican"
gen kms1 = 0
replace kms1 = 1 if CC20_311b == 3 & CurrentSen1Party=="Democratic"
replace kms1 = 1 if CC20_311b == 2 & CurrentSen1Party=="Republican"
gen kms2 = 0
replace kms2 = 1 if CC20_311c == 3 & CurrentSen2Party=="Democratic"
replace kms2 = 1 if CC20_311c == 2 & CurrentSen2Party=="Republican"
gen kgov = 0
replace kgov = 1 if CC20_311a == 3 & CurrentGovParty=="Democratic"
replace kgov = 1 if CC20_311a == 2 & CurrentGovParty=="Republican"
alpha khouse ksen kmh kms1 kms2 kgov, item gen(pknow)
lab var pknow "Political knowledge"

***Tables and figues from news experiment
***SM Table 34. Predictors of Punishment Selected for Voter Fraud News Experiment, White Respondents
***Crosstab of support for prison by news treatment
tab vfprison meximm if white==1 [aw=teamweight], col
***Crosstab of support for community service by news treatment
tab vfcserv meximm if white==1 [aw=teamweight], col
***Crosstab of support for a warning (and no other punishment) by news treatment
tab vfwarn meximm if white==1 [aw=teamweight], col
***Crosstab of support for a fine by news treatment
tab vffine meximm if white==1 [aw=teamweight], col
***Crosstab of support for probation by news treatment
tab vfprob meximm if white==1 [aw=teamweight], col

***SM Table 34. Model 1 - choice of prison as punishment
logit vfprison i.meximm##c.latracism1 pi1 ni1 age1 ed1 female [pw=teamweight] if white==1
***Estimated treatment for respondents with low Latino racism
mchange meximm, at(latracism1=.2) statistics(change from to pvalue) brief
***Estimated treatment for respondents with high Latino racism
mchange meximm, at(latracism1=.8) statistics(change from to pvalue) brief

***Main text, Figure 7
***create predicted probabilities of support for prison for the Mexican treatment at different levels of LRE
mgen, at(latracism1=(0(.1)1) meximm=1) stub(m) level(90) predlabel(Pr(support))
***create predicted probabilities of support for prison for the Irish treatment at different levels of LRE
mgen, at(latracism1=(0(.1)1) meximm=0) stub(i) level(90) predlabel(Pr(support))
***label the new variables indicating the predicted probability of prison as punishment
label variable mpr "Mexican Immigrant" 
label variable ipr "Irish Immigrant" 
***plot the predicted probability measures by levels of Latino racism, with confidence intervals
twoway (rarea mul1 mll1 mlatracism1, col(gs12)) (rarea iul1 ill1 mlatracism1, col(gs13)) (connected mpr mlatracism1, sort clcolor(black) clpat(solid) clwidth(medthick) msymbol(i) mcolor(none)) (connected ipr mlatracism1, sort clcolor(black) clpat(dash) clwidth(medthick) msymbol(i) mcolor(none)) , ytitle("Probability of Support for Prison Time") ylabel(, grid glwidth(medium) glpattern(solid)) legend(off) graphregion(color(white)) ytitle(, size(medlarge)) ylabel(, angle(0) nogrid tlwidth(medthick)) ylabel(, labsize(medlarge)) xtitle(, size(medlarge)) xlabel(, nogrid tlwidth(medthick)) xlabel(, labsize(medlarge))

***SM Table 34. Model 2 - choice of community service as punishment
logit vfcserv i.meximm##c.latracism1 pi1 ni1 age1 ed1 female [pw=teamweight] if white==1
***Estimate impact of Latino racism for each treatment condition
mchange latracism1, at(meximm=0) statistics(change from to pvalue) brief
mchange latracism1, at(meximm=1) statistics(change from to pvalue) brief

***SM Table 34. Model 3 - choice of warning (and no other punishment) as punishment
logit vfwarn i.meximm##c.latracism1 pi1 ni1 age1 ed1 female [pw=teamweight] if white==1
***Estimate impact of Latino racism for each treatment condition
mchange latracism1, at(meximm=0) statistics(change from to pvalue) brief
mchange latracism1, at(meximm=1) statistics(change from to pvalue) brief

***SM Table 34. Model 4 - choice of fine as punishment
logit vffine i.meximm##c.latracism1 pi1 ni1 age1 ed1 female [pw=teamweight] if white==1

***SM Table 34. Model 5 - choice of probation as punishment
logit vfprob i.meximm##c.latracism1 pi1 ni1 age1 ed1 female [pw=teamweight] if white==1

***SM Table 35. Predictors of Anger about Voter Fraud from News Experiment, White Respondents
***SM Table 35. Model 1 - OLS
reg UMS441_rule i.meximm##c.latracism1 pi1 ni1 age1 ed1 female [aw=teamweight] if white==1
reg UMS441_rule_dk_flag i.meximm##c.latracism1 pi1 age1 ed1 [aw=teamweight] if white==1
***Latino racism reduces likelihood of saying DK on anger question
recode UMS441_rule_dk_flag (0=1) (1=0), gen(angselect)
***SM Table 35. Model 2 - Selection Model
heckman UMS441_rule i.meximm##c.latracism1 pi1 age1 ed1 [pw=teamweight] if white==1, select(angselect=i.mexim latracism1 pi1 age1 pknow newsint)



